<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>Document</title>
	</head>

	<body>
		<pre>
        按键修饰符
            产生原因：在监听键盘事件时，监听某一个按键，从而简化操作

            .enter  回车键
            .delete  删除键
    </pre>

		<div id="app">
			<!-- enter 监听回车 -->
			<input type="text" v-model="val" @keyup.enter="handle" />

			<!-- delete 监听删除键 -->
			<input type="text" v-model="val" @keyup.delete="delete" />
		</div>

		<script src="/scripts/vue.js"></script>
		<script>
			var vm = new Vue({
				el: '#app',
				data: {
					val: '',
				},
				methods: {
					handle() {
						console.log(this.val)
					},
					delete() {
						this.val = ''
					},
				},
			})
		</script>
	</body>
</html>
